package kr.saeildamil.androidstudy.ch12;

import java.util.ArrayList;

import kr.saeildamil.androidstudy.R;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import android.widget.Toast;

public class ListIconText extends Activity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.ch12_listviewtest);

		ArrayList<MyItem> arList = new ArrayList<MyItem>();
		arList.add(new MyItem(R.drawable.suzy, "삼성노트북"));
		arList.add(new MyItem(R.drawable.suzy, "LG 세탁기"));
		arList.add(new MyItem(R.drawable.suzy, "대우 마티즈"));

		MyListAdapter adapter = new MyListAdapter(this, R.layout.ch12_icontext,
				arList);

		ListView listView = (ListView) findViewById(R.id.ch12_listviewtest_list);
		listView.setAdapter(adapter);
		listView.setOnItemClickListener(new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> parent, View view,
					int position, long id) {
				Toast.makeText(ListIconText.this, "Weight : ",
						Toast.LENGTH_LONG).show();
			}

		});
	}
}
